﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections;
using System.IO;

namespace TouchUmlUI
{    

    public class HintBoxClass : HintBoxBase
    {
        public enum ButtonEvent { ROTATE, DELETE };

        HoverButton rotateButton;
        HoverButton deleteButton;
        String imgRotate = "ikony\\icon_rotate.png";
        String imgRotateHover = "ikony\\icon_rotatehover.png";
        String imgDelete = "ikony\\icon_delete.png";
        String imgDeleteHover = "ikony\\icon_deletehover.png";

        ~HintBoxClass()
        {
            rotateButton = null;
            deleteButton = null;
        }

        public void addButtonEventHandler(ButtonEvent be,MouseButtonEventHandler mBe)
        {
            if (be == ButtonEvent.ROTATE)
            {
                rotateButton.addClickHandler(mBe);
            }
            else if (be == ButtonEvent.DELETE)
            {
                deleteButton.addClickHandler(mBe);
            }
        }

        public void mouseEnter(object sender, RoutedEventArgs e)
        {
            windowParent.activeObj = this;
        }

        public void mouseLeave(object sender, RoutedEventArgs e)
        {
            windowParent.activeObj = null;
        }

        public HintBoxClass(double px,double py, UMLObj umlObj) : base(px,py)
        {
            this.MouseEnter += mouseEnter;
            this.MouseLeave += mouseLeave;
            this.Name = "hintBoxClass";
            this.umlObj = umlObj;           
            this.Background = Brushes.Transparent;
            this.Width = 46;
            this.Height = 95;
            rotateButton = new HoverButton(imgRotate, imgRotateHover, 44, 46);
            deleteButton = new HoverButton(imgDelete, imgDeleteHover, 44, 46);

            Canvas.SetLeft(rotateButton, 1);
            Canvas.SetTop(rotateButton, 1);
            Canvas.SetLeft(deleteButton, 1);
            Canvas.SetTop(deleteButton, 40);
            this.Children.Add(rotateButton);
            this.Children.Add(deleteButton);
            this.startClock();
        }
    }
}
